DXL won't run after commenting code..

This is probably a really easy fix, but I cannot seem to find the problem. My DXL was running perfectly fine, until I commented it. Now its giving me an error saying badly formed token at line 355, then in the Edit DXL menu it is printing out code preceding this line in the menu and then says it stopped printing errors due to there being too many. I have looked around the line it said the error occurs and also where the code starts to print out on the Edit DXL menu. I'm kind of clueless at this point so any input or ideas would be appreciated.

Thanks

Eric
Eric_Hillen - Mon Apr 25 11:58:29 EDT 2011

Re: DXL won't run after commenting code..
Eric_Hillen - Mon Apr 25 12:08:42 EDT 2011

To give more information on this, the badly formed token starts at the end of one function, contains the next function and then ends with the beginning of the next function. All the instances in which the function that is shown on the Edit DXL Menus is called, comes up with an undeclared variable error. Also, it comes with two errors of undeclared variable(the) and undeclared variable(s).

Re: DXL won't run after commenting code..
Mathias Mamsch - Mon Apr 25 13:27:26 EDT 2011

I think there might be multiple reasons for this.

You need to know that comments ending on "-" will comment out the newline, i.e.
 

a = 4  // some number -
    +5 // this comment will work -
    +7 // since the newlines will be ignored.

 


So this is like:

 

 

a = 4 /* some number */ + 5 /* this comment will work */ + 7 /* ... */



Therefore there is a slight chance this might be the reason, you have a comment on a line before that you ended with "-". But usually that won't give you a "bad token" error but more likely a "syntax error" or something like that. Notice that an empty comment "//" immediately followed by a newline will also make DOORS ignore the newline.

So the bad token error might come from a new file encoding. Try putting



 

 

 

pragma encoding, "UTF-8"



at the top of your file and store your file with a suitable text editor in UTF encoding. Bad Token errors will also come from characters that are not expected in the current encoding, e.g. if DOORS tries to parse your script in ANSI, then you will get bad tokens when using non-ascii characters like german umlauts 'ö' or french accents 'á', etc. Also make sure the line endings are ok.

The next reason for a bad token error is a wrong character in a string. Something like s = "\e" will give you a bad token error.

Maybe these hints help you to spot an error. Regards, Mathias



 

 

 


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

 

Re: DXL won't run after commenting code..
Eric_Hillen - Mon Apr 25 13:39:20 EDT 2011

Mathias Mamsch - Mon Apr 25 13:27:26 EDT 2011

I think there might be multiple reasons for this.

You need to know that comments ending on "-" will comment out the newline, i.e.
 

a = 4  // some number -
    +5 // this comment will work -
    +7 // since the newlines will be ignored.

 


So this is like:

 

 

a = 4 /* some number */ + 5 /* this comment will work */ + 7 /* ... */



Therefore there is a slight chance this might be the reason, you have a comment on a line before that you ended with "-". But usually that won't give you a "bad token" error but more likely a "syntax error" or something like that. Notice that an empty comment "//" immediately followed by a newline will also make DOORS ignore the newline.

So the bad token error might come from a new file encoding. Try putting



 

 

 

pragma encoding, "UTF-8"



at the top of your file and store your file with a suitable text editor in UTF encoding. Bad Token errors will also come from characters that are not expected in the current encoding, e.g. if DOORS tries to parse your script in ANSI, then you will get bad tokens when using non-ascii characters like german umlauts 'ö' or french accents 'á', etc. Also make sure the line endings are ok.

The next reason for a bad token error is a wrong character in a string. Something like s = "\e" will give you a bad token error.

Maybe these hints help you to spot an error. Regards, Mathias



 

 

 


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

 

Would you be able to explain the first part you mentioned a little better? To clear that up, I don't have any instances in which "-" is at the end of a comment. I am currently using a DXL editor and

pragma encoding, "UTF-8"


is already in there. And the only instance in which I have a "\" in a string is when I want a new line and this never gave me problems before. If needed I can supply the snippet of code that is considered the "bad" token.

Thanks

Re: DXL won't run after commenting code..
Eric_Hillen - Mon Apr 25 13:42:47 EDT 2011

Eric_Hillen - Mon Apr 25 13:39:20 EDT 2011

Would you be able to explain the first part you mentioned a little better? To clear that up, I don't have any instances in which "-" is at the end of a comment. I am currently using a DXL editor and

pragma encoding, "UTF-8"


is already in there. And the only instance in which I have a "\" in a string is when I want a new line and this never gave me problems before. If needed I can supply the snippet of code that is considered the "bad" token.

Thanks

.......found the problem. I kept thinking that there was a spec on my screen, but I just tried to wipe it off an it was a random "'"

/Sigh

Thanks for the help!

Eric

Re: DXL won't run after commenting code..
llandale - Mon Apr 25 20:56:05 EDT 2011

You may NEED to add a dash in a comment:

int i,
    j,
    k
// turns into this when commented:
int i, // whatever -
    j, // whatever -
    k  // whatever


I also wonder if you are using nested comment blocks. Consider this:

 

/* Lets comment out this code starting here to the bottom
    int i = 0
        /* Embedded comment block
           more
        */
        int j = i
**** end comment block */


Well, the internal comment block ending at line 5 will end BOTH comment blocks, revealing "int j = i" which generates an error because i isn't defined. This discourages me from using comment blocks inside the code other than at the top, in case I want to comment out whole sections.

 

 

 

  • Louie